package com.wwu.system.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wwu.common.constant.CommConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 定时任务实体
 * @author 一蓑烟雨
 * @date  2023-07-04
 * @version  1.0.0
 */
@Data
@Accessors(chain = true)
@TableName("sys_quartz")
@ApiModel(value="SysQuartz:定时任务实体", description="定时任务实体")
public class SysQuartz implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "任务id")
    @TableId(value = "quartz_id", type = IdType.ASSIGN_ID)
    private String quartzId;

    @ApiModelProperty(value = "任务名称")
    @TableField("quartz_name")
    private String quartzName;

    @ApiModelProperty(value = "任务描述")
    @TableField("quartz_desc")
    private String quartzDesc;

    @ApiModelProperty(value = "cron表达式")
    @TableField("quartz_cron")
    private String quartzCron;

    @ApiModelProperty(value = "cron中文含义")
    @TableField("quartz_cron_zh")
    private String quartzCronZh;

    @ApiModelProperty(value = "任务类名")
    @TableField("quartz_class")
    private String quartzClass;

    @ApiModelProperty(value = "任务配置参数")
    @TableField("quartz_param")
    private String quartzParam;

    @ApiModelProperty(value = "任务类型（0:内置；1:外配）")
    @TableField("quartz_type")
    private Integer quartzType;

    @ApiModelProperty(value = "启动状态（0:启动；1:停止）")
    @TableField("quartz_status")
    private Integer quartzStatus;

    @ApiModelProperty(value = "执行状态（0:成功；1:失败）")
    @TableField("last_exec_status")
    private Integer lastExecStatus;

    @ApiModelProperty(value = "上次执行时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField("last_exec_time")
    private LocalDateTime lastExecTime;

    @ApiModelProperty(value = "下次执行时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField("next_exec_time")
    private LocalDateTime nextExecTime;

    @ApiModelProperty(value = "删除状态(0:逻辑未删除；1:逻辑已删除)")
    @TableField("del_flag")
    @TableLogic
    private Integer delFlag;

    @ApiModelProperty(value = "创建人")
    @TableField(value = "creator",fill = FieldFill.INSERT)
    private String creator;

    @ApiModelProperty(value = "创建时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改人")
    @TableField(value = "modifier",fill = FieldFill.INSERT_UPDATE)
    private String modifier;

    @ApiModelProperty(value = "修改时间")
    /** 格式化后台和前端显示样式 */
    @DateTimeFormat(pattern = CommConst.DATE_TIME)
    @JsonFormat(pattern = CommConst.DATE_TIME,timezone = CommConst.TIME_ZONE)
    @TableField(value = "modify_time",fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifyTime;
}
